package FunctionPackage;

import BookListPackage.BookList;

import java.util.Scanner;

public class Repaid implements Function {

    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书！");
        System.out.println("请输入要归还的书名:");
        Scanner scanner = new Scanner(System.in);
        String bookName = scanner.nextLine();
        //找到书名
        for (int i = 0; i < bookList.amount; i++) {
            if (bookName.equals(bookList.books[i].getBookName())) {
                bookList.books[i].setBorrow(false);
                System.out.println("-------归还成功!!!-------");
                return;
            }
        }
        System.out.println("---------未找到要归还的书名!!!-------");
    }

}
